package com.fernfx.xingtan.common.photo;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.fernfx.xingtan.R;
import com.fernfx.xingtan.common.base.BaseAdapter;
import com.fernfx.xingtan.main.entity.RobredPacketHistroyEntity;
import com.fernfx.xingtan.utils.OtherUtil;

import java.util.List;

/**
 * Created by admin on 2018/8/22.
 */

public class RobredPacketHistroyAdapter extends BaseAdapter {
    private List<RobredPacketHistroyEntity.ObjBean.RecordsBean> dataList;
    private Context context;

    public RobredPacketHistroyAdapter(Context context, List dataList) {
        super(context, dataList);
        this.dataList = dataList;
        this.context = context;
    }

    @Override
    public int getLayoutId() {
        return R.layout.adapter_pull_refresh;
    }

    @Override
    public Holder initHolder(View container) {
        RobredPakcetHistroyHolder holder = new RobredPakcetHistroyHolder();
        holder.title1TextTv = container.findViewById(R.id.title1_text_tv);
        holder.title1ContentTv = container.findViewById(R.id.title1_content_tv);
        holder.title2TextTv = container.findViewById(R.id.title2_text_tv);
        holder.title2ContentTv = container.findViewById(R.id.title2_content_tv);
        return holder;
    }

    @Override
    public void initItem(View view, Holder holder, int position) {
        RobredPakcetHistroyHolder roredPacketHolder = (RobredPakcetHistroyHolder) holder;
        //item
        RobredPacketHistroyEntity.ObjBean.RecordsBean recordsBean = dataList.get(position);
        roredPacketHolder.title1TextTv.setText("发红包");
        roredPacketHolder.title1ContentTv.setText(OtherUtil.checkEmptyDefault(recordsBean.getDate()));
        roredPacketHolder.title2TextTv.setText("￥" + OtherUtil.checkEmptyDefault(recordsBean.getAmount() + ""));
        roredPacketHolder.title2ContentTv.setText("-" + OtherUtil.checkEmptyDefault(recordsBean.getAmount() + "") + "元");
    }

    class RobredPakcetHistroyHolder extends Holder {
        TextView title1TextTv;
        TextView title1ContentTv;
        TextView title2TextTv;
        TextView title2ContentTv;
    }
}
